WTL Controls
Back to the WTL Controls Home Page.
BIS_WTL_CONTROLS::CEditPlus Class Reference

A CEdit descendant, providing custom focused and non-focused colors via WM_CTLCOLOR variants. More...

#include <EditPlus.h>

Inheritance diagram for BIS_WTL_CONTROLS::CEditPlus:

Public Member Functions

 CEditPlus () noexcept
 
virtual ~CEditPlus ()
 
void SubclassEdit (HWND hWnd)
 Subclass an edit control and create GDI objects. More...
 
void UnSubclassEdit ()
 Un-subclass the window and release GDI resources. More...
 
void SetBackColor (COLORREF value)
 Select a new background color used when the control does not have focus. More...
 
COLORREF GetBackColor () const
 Default: COLOR_WINDOW. More...
 
void SetTextColor (COLORREF value)
 Select a new text color used when the control does not have focus. More...
 
COLORREF GetTextColor () const
 Default: COLOR_WINDOWTEXT. More...
 
void SetFocusedBackColor (COLORREF value)
 Select a new background color used when the control has focus. More...
 
COLORREF GetFocusedBackColor () const
 Default: COLOR_WINDOW. More...
 
void SetFocusedTextColor (COLORREF value)
 Select a new text color used when the control has focus. More...
 
COLORREF GetFocusedTextColor () const
 Default: CLR_RED. More...
 
void EnableFloatingPointMode (bool enabled)
 Change the Floating Point Mode state. More...
 
bool IsFloatingPointModeEnabled () const
 Default: false. More...
 
void EnableNotifyOnCR (bool value)
 Change the 'Notify on CR' state. More...
 
bool IsNotifyOnCREnabled () const
 Default: true. More...
 

Detailed Description

A CEdit descendant, providing custom focused and non-focused colors via WM_CTLCOLOR variants.

A CEdit with custom colors and which sends an optional custom message (WM_EDITP_EDIT_END) when the user hits VK_RETURN. It also supports a 'Floating Point Mode', that will allow for numerical data entry, including a decimal point, negative sign and the base 10 exponent operator 'E'.

The parent dialog must reflect WM_CTLCOLOREDIT (or WM_CTLCOLORSTATIC, if the control is read-only) messages to the control. Use either the non-discriminating REFLECT_NOTIFICATIONS_EX, or with something more selective (e.g, REFLECT_NOTIFICATIONS_MSG_FILTERED).

Typical usage is depicted below.

CEditPlus m_Eds;
m_Eds.SubclassEdit(GetDlgItem(IDC_ED1));
m_Eds.EnableFloatingPointMode(true);
.
.
.
m_Eds.UnSubclassEdit(); // when finished using the control (probably in OnEndDialog).

Definition at line 46 of file EditPlus.h.

Constructor & Destructor Documentation

◆ CEditPlus()

BIS_WTL_CONTROLS::CEditPlus::CEditPlus ( )
noexcept

Definition at line 26 of file EditPlus.cpp.

◆ ~CEditPlus()

BIS_WTL_CONTROLS::CEditPlus::~CEditPlus ( )
virtual

Definition at line 41 of file EditPlus.cpp.

Member Function Documentation

◆ SubclassEdit()

void BIS_WTL_CONTROLS::CEditPlus::SubclassEdit ( HWND  hWnd)

Subclass an edit control and create GDI objects.

Parameters
hWndThe window handle of the edit control to subclass.
Return values
void

Definition at line 57 of file EditPlus.cpp.

◆ UnSubclassEdit()

void BIS_WTL_CONTROLS::CEditPlus::UnSubclassEdit ( )

Un-subclass the window and release GDI resources.

Definition at line 70 of file EditPlus.cpp.

◆ SetBackColor()

void BIS_WTL_CONTROLS::CEditPlus::SetBackColor ( COLORREF  value)

Select a new background color used when the control does not have focus.

Parameters
valueThe new non-focused background color.
Return values
void

Definition at line 100 of file EditPlus.cpp.

◆ GetBackColor()

COLORREF BIS_WTL_CONTROLS::CEditPlus::GetBackColor ( ) const

Default: COLOR_WINDOW.

Returns the color used for the background when the countrol does not have focus.

Return values
COLORREFThe non-focused background color.

Definition at line 86 of file EditPlus.cpp.

◆ SetTextColor()

void BIS_WTL_CONTROLS::CEditPlus::SetTextColor ( COLORREF  value)

Select a new text color used when the control does not have focus.

Parameters
valueThe new non-focused text color.
Return values
void

Definition at line 134 of file EditPlus.cpp.

◆ GetTextColor()

COLORREF BIS_WTL_CONTROLS::CEditPlus::GetTextColor ( ) const

Default: COLOR_WINDOWTEXT.

Returns the color used for text when the control does not have focus.

Return values
COLORREFNon-focused text color.

Definition at line 119 of file EditPlus.cpp.

◆ SetFocusedBackColor()

void BIS_WTL_CONTROLS::CEditPlus::SetFocusedBackColor ( COLORREF  value)

Select a new background color used when the control has focus.

Parameters
valueThe new focused background color.
Return values
void

Definition at line 162 of file EditPlus.cpp.

◆ GetFocusedBackColor()

COLORREF BIS_WTL_CONTROLS::CEditPlus::GetFocusedBackColor ( ) const

Default: COLOR_WINDOW.

The background color used when the control has focus.

Return values
COLORREFFocused background color.

Definition at line 148 of file EditPlus.cpp.

◆ SetFocusedTextColor()

void BIS_WTL_CONTROLS::CEditPlus::SetFocusedTextColor ( COLORREF  value)

Select a new text color used when the control has focus.

Parameters
valueThe new focused text color.
Return values
void

Definition at line 196 of file EditPlus.cpp.

◆ GetFocusedTextColor()

COLORREF BIS_WTL_CONTROLS::CEditPlus::GetFocusedTextColor ( ) const

Default: CLR_RED.

Returns the color used for text when the control has focus.

Return values
COLORREFFocused text color.

Definition at line 181 of file EditPlus.cpp.

◆ EnableFloatingPointMode()

void BIS_WTL_CONTROLS::CEditPlus::EnableFloatingPointMode ( bool  value)

Change the Floating Point Mode state.

Parameters
valueNew bool state.
Return values
void

Definition at line 224 of file EditPlus.cpp.

◆ IsFloatingPointModeEnabled()

bool BIS_WTL_CONTROLS::CEditPlus::IsFloatingPointModeEnabled ( ) const

Default: false.

If true, only characters constituting floating point values will be included (including the base 10 exponential operator 'E').

Definition at line 209 of file EditPlus.cpp.

◆ EnableNotifyOnCR()

void BIS_WTL_CONTROLS::CEditPlus::EnableNotifyOnCR ( bool  value)

Change the 'Notify on CR' state.

Parameters
valueNew bool state.

Definition at line 253 of file EditPlus.cpp.

◆ IsNotifyOnCREnabled()

bool BIS_WTL_CONTROLS::CEditPlus::IsNotifyOnCREnabled ( ) const

Default: true.

If true, the control will send it's parent a 'WM_EDITP_EDIT_END' message (defined as WM_APP + 1011 in WTK_Controls.h) when the user hits the 'Enter' key (VK_RETURN) while the control has focus.

Return values
boolThe 'Notify on CR' state. state.

Definition at line 240 of file EditPlus.cpp.


The documentation for this class was generated from the following files: